package org.hot100_6.leetcode94;

import org.leetcode.TreeNode;

import java.util.ArrayList;
import java.util.List;

public class Solution {
    public List<Integer> inorderTraversal(TreeNode root) {

        return inorder(root, new ArrayList<>());

    }

    public List<Integer> inorder(TreeNode root, List<Integer> res) {

        if (root == null){
            return res;
        }

        inorder(root.left, res);

        res.add(root.val);

        inorder(root.right, res);

        return res;
    }
}
